#ifndef GLOBAL_H
#define GLOBAL_H

#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <glib.h>

#include "syntree.h"
#include "symtable.h"
#include "gencode.h"
#include "mips.h"

// Type des données stockées
enum data_type
{
	// Identifiant
	T_ID = 0,
	T_ID_STR,
	// Type
	T_TYPE,	
	// Opération
	T_OP,
	// Constantes
	T_INT,
	T_BOOL,
	T_UNIT,
	T_STRING,
	T_ARRAY,
	T_RANGE
};

enum op_type
{
	O_PROGRAM = 10000,
	O_VARSDECLLIST,
	O_VAR,
	O_IDENTLIST,
	O_RANGELIST,
	O_FUNDECLLIST,
	O_ARGLIST,
	O_SEQUENCE,
	O_BEGIN,
	
	O_FUNCCALL,
	
	O_IF, //10010
	O_WHILE,
	
	O_READ,
	O_WRITE,
	
	O_AFF,
	
	O_RETURN, //10015
	
	O_PLUS,
	O_MINUS,
	O_TIMES,
	O_DIV,
	O_MOD,// 10020
	
	O_ARRAYACCESS, 
	
	O_POW,
	O_LT,
	O_LE,
	O_GT,// 10025
	O_GE, 
	O_EQ,
	O_NE,
	O_AND,
	O_OR, // 10030
	O_XOR,
	
	O_NOT,
	
	O_FUNCTION,
	O_EXPRLIST
};

// YACC
extern int   yylex();
extern FILE* yyin;
extern char* yytext;
extern int yylineno;
int yyerror(char*);

// Parsing
extern int   is_error;
extern char* input_file;
extern char* output_file;
extern int   is_global;

// Table des symboles
extern symtable* table;
// Données
extern gencode* data;
// Code
extern gencode* code;
// Arbre de syntaxe
extern syntree* tree;
// N° label
extern int labelno;

#endif
